package com.ms.p2p.service.impl;


import com.ms.p2p.bean.PageBean;
import com.ms.p2p.dao.AuthDao;
import com.ms.p2p.entity.member.Auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class CertiFiCationServiceImpl {

	@Autowired
	AuthDao authDao;
	public String getCertiStatus(int userId) {
		Auth auth = findByUserId(userId);
		if(auth==null){
			return "您还未进行实名认证";
		} else {
			if(auth.getStatus()==1){
				return "";
			}else{
				return  "您尚未通过实名认证";
			}
		}

	}

	/**
	 * 根据用户ID查询实名认证信息
	 * 
	 * @param userId
	 * @return
	 */
	public Auth findByUserId(int userId) {
		return authDao.findByUserId(userId);

	}

	/**
	 * @Title: findById
	 * @Description: 根据id查
	 * @param id
	 * @return RealName 返回类型
	 */
	public Auth findById(String id) {
		return  authDao.get(id);

	}
	public List<Map<String, Object>> findPager(String userId,String userName,String realname,String begin_date,String end_date,String status,PageBean pageBean){
		return authDao.findPager(userId,userName,realname,begin_date,end_date,status,pageBean.getBegin(),pageBean.getPageSize());
	}
	public int findCount(String userId,String userName,String realname,String begin_date,String end_date,String status){
		return authDao.findCount(userId,userName,realname,begin_date,end_date,status);
	}


	/**
	 *
	 * @return int 返回类型
	 */
	public int insert(Auth auth) {
		return  authDao.insert(auth);
	}

	/**
	 * @return int 返回类型
	 */
	public int update(Auth auth) {
		return authDao.update(auth);
	}


	public int findOther(String id_number, Integer id) {
		return authDao.findOther(id_number,id);
	}
}
